<!-- parcelas/show -->
<h1>Despesa parcelada</h1>

<%= flash_alerts %>

<div class="row-fluid">
	<div class="span12">
		<fieldset>
			<%= show_model @parcelado, :only => ["data", "valor", "parcelas", "observacao"] %>

			<%= link_to "Parcelamento", parcelado_path(@parcelado) %>
		</fieldset>
	</div>
</div>

<div class="row-fluid" style="position:absolute;z-index=1;">
	<div class="span12" id="parcela">
		
		<%= errors_for @parcela %>
		
		<fieldset>
			<legend>Parcela</legend>

			<%= show_model @parcela, :only => ["data", "valor", "observacao", "quitada?"] %>

			<% unless @parcela.quitada? %>
				<%= link_to "Quitar", "#quitacao",
					"data-master" => "#parcela",
					:class => "btn btn-primary alternate" %>
			<% end %>

		</fieldset>

		<%= link_to "Voltar", :back %>

	</div>
</div>

<div class="row-fluid" style="position:absolute;z-index=9999;">
	<div class="span12" id="quitacao" style="display:none;">
		<fieldset>
			<legend>Quitação</legend>

			<%= form_tag quitar_parcela_path(@parcela), :method => :put do %>
				<div>
					<%= label_tag :conta_id %>
					<%= select_tag :conta_id,
						options_from_collection_for_select(current_usuario.contas_ativas, :id, :nome),
						:include_blank => true %>
				</div>

				<div>
					<%= label_tag :data %>
					<%= select_date @quitado_em, {}, :class => "span2" %>
				</div>
	
				<div class="spacer">
					<%= submit_tag "Enviar", :class => "btn btn-primary" %>
					<%= link_to "Cancelar", "#parcela",
						"data-master" => "#quitacao",
						:class => "btn btn-danger alternate" %>
				</div>
			<% end %>

		</fieldset>
		
		<%= link_to "Voltar", :back %>
		
	</div>
</div>	


